package com.example.springioc.controller;

import com.example.springioc.component.UserComponent;
import com.example.springioc.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Indexed;

import java.util.HashMap;
import java.util.TreeSet;

@Controller
public class HelloController {
    //@Autowired
    private UserService userService;
    //@Autowired
    private UserComponent userComponent;

    public HelloController() {
    }

    public HelloController(UserService userService) {
        this.userService = userService;
    }

    @Autowired
    public HelloController(UserService userService, UserComponent userComponent) {
        this.userService = userService;
        this.userComponent = userComponent;
    }

    public void sayHi() {
        userService.doService();
        userComponent.doComponent();
        System.out.println("hi, HelloController");
    }
}

